<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
<%@ page trimDirectiveWhitespaces="true"%>

<jsp:useBean id="manager" class="beans.ChatBean" scope="request">
    <c:set target="${manager}" property="request" value="${pageContext.request}" />
    <c:set target="${manager}" property="response" value="${pageContext.response}" />
    <c:set target="${manager}" property="session" value="${pageContext.session}" />
</jsp:useBean>

<c:choose>
    <c:when test="${manager.load == true}">
        <!DOCTYPE html>
        <html>
            <head>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                <link rel="stylesheet" href="core/css/style.css" type="text/css" />
                <link type="text/css" href="core/css/jquery-ui-1.8.16.custom.css" rel="Stylesheet"/>	
                <script type="text/javascript" src="core/js/script.js" ></script>
                <script type="text/javascript" src="core/js/tiny_mce/tiny_mce.js"></script>
                <title>JChat</title>
            </head>
            <body>


                <div id="msgContainer"></div>
                

                
                <div id="EditorContainer">
                    <table id="editorTable">
                            <tr>
                                <td id="editorTDmsg"><textarea id="msg" name="content" maxlength="1000" onkeypress="ctrlEnterSendStyle(event);"></textarea></td>
                                <td id="editorTDsend"><button id="btnSend" onclick="sendMessage();">Отправить сообщение</button></td>
                                <td><image id="msgSending" src="core/images/misc/ajax-loader-msg.gif" alt=""/></td>
                            </tr>
                    </table>
                </div>                

                <div id="usrContainer">
                    <c:import url="core/forms/userlist_form.jsp" charEncoding="utf-8"></c:import>
                </div>
                
                <button id="btnChatRefresh" onclick="chatRefresh();">Обновить сообщения</button>
                
                <div id="btnScrollSelector">
                    <input type="checkbox" id="chkScroll" onchange="changeMsgScroll();" />
                    <label for="chkScroll">Прокрутка чата</label>
                </div>
                
                <div id="dialog-modal"></div>
                
                <script>
                    window.setInterval("chatRefresh();", 3000);
                </script>
                
            </body>
        </html>        
    </c:when>
    <c:when test="${manager.load == false}">
        <c:redirect url="auth.jsp"></c:redirect>
    </c:when>
</c:choose>